using Senparc.Weixin.QY.AdvancedAPIs.LoginAuth;
using Senparc.Weixin.QY.CommonAPIs;
using System;
namespace Senparc.Weixin.QY.AdvancedAPIs
{
	public static class LoginAuthApi
	{
		public static string GetLoginAuthUrl(string corpId, string redirectUrl, string state)
		{
			return string.Format("https://qy.weixin.qq.com/cgi-bin/loginpage?corp_id={0}&redirect_uri={1}&state={2}", corpId, redirectUrl, state);
		}
		public static GetLoginInfoResult GetLoginInfo(string providerAccessToken, string authCode, int timeOut = 10000)
		{
			string urlFormat = "https://qyapi.weixin.qq.com/cgi-bin/service/login_info?provider_access_token={0}";
			var data = new
			{
				auth_code = authCode
			};
			return CommonJsonSend.Send<GetLoginInfoResult>(providerAccessToken, urlFormat, data, CommonJsonSendType.POST, timeOut);
		}
	}
}
